//
//  MainAreaViewController.m
//  GLGW_Shoping
//
//  Created by whx on 2018/12/20.
//  Copyright © 2018年 yang. All rights reserved.
//

#import "MainAreaViewController.h"
#import "MainAreaCitysViewController.h"
#import "MainAreaViewModel.h"
#import "MainAreaModel.h"

@interface MainAreaViewController ()
@property (nonatomic, strong) MainAreaViewModel *viewModel;
@end

@implementation MainAreaViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"选择地区";
    self.viewModel = [[MainAreaViewModel alloc] initWithViewToViewModel:self.groupedTableView theSuperView:self.view];
    kWeakSelf(self);
    self.viewModel.BlockSelecRow = ^(NSMutableDictionary *dic) {
        [weakself seleRow:dic];
    };
}

- (void)seleRow:(NSMutableDictionary *)dic
{
    MainAreaCitysViewController *vc = [MainAreaCitysViewController new];
    vc.BlockSelectDic = ^(NSMutableDictionary *dic) {
        [self.viewModel makeLastPageSelectDic:dic];
    };
    vc.dic = [NSMutableDictionary dictionaryWithDictionary:dic];
    int select = [dic[@"select"] intValue];
    NSArray *arr = dic[@"arr"];
    NSDictionary *liDic = arr[select];
    MainAreaListModel *listMode = liDic[@"two"];
    vc.title = listMode.provinceName;
    [self.navigationController pushViewController:vc animated:YES];
}

@end
